package com.esri.core.tasks.identify;

import com.esri.core.internal.tasks.c.a;
import com.esri.core.internal.tasks.e;
import com.esri.core.io.UserCredentials;
import com.esri.core.map.CallbackListener;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;

/* loaded from: classes.dex */
public class IdentifyTask {
    private String _url;
    private UserCredentials credential;

    public IdentifyTask(String str) {
        this.credential = null;
        this._url = str;
    }

    public IdentifyTask(String str, UserCredentials userCredentials) {
        this.credential = null;
        this._url = str;
        this.credential = userCredentials != null ? userCredentials.getCopy() : null;
    }

    public IdentifyResult[] execute(IdentifyParameters identifyParameters) throws Exception {
        return new a(identifyParameters.getParams(), this._url, this.credential).execute();
    }

    public Future<IdentifyResult[]> execute(final IdentifyParameters identifyParameters, final CallbackListener<IdentifyResult[]> callbackListener) {
        return e.b.submit(new Callable<IdentifyResult[]>() { // from class: com.esri.core.tasks.identify.IdentifyTask.1
            @Override // java.util.concurrent.Callable
            public IdentifyResult[] call() throws Exception {
                IdentifyResult[] identifyResultArr = null;
                try {
                    identifyResultArr = IdentifyTask.this.execute(identifyParameters);
                } catch (Exception e) {
                    CallbackListener callbackListener2 = callbackListener;
                    if (callbackListener2 != null) {
                        callbackListener2.onError(e);
                    } else {
                        throw e;
                    }
                }
                if (Thread.currentThread().isInterrupted()) {
                    return identifyResultArr;
                }
                CallbackListener callbackListener3 = callbackListener;
                if (callbackListener3 != null) {
                    callbackListener3.onCallback(identifyResultArr);
                }
                return identifyResultArr;
            }
        });
    }
}
